package com.duofan.gmall.common.exception;

/**
 * 错误码和错误信息
 * 10: 通用
 *   001 参数格式校验
 *   002 短信验证码发送频率过高
 * 11 商品
 * 12 订单
 * 13 购物车
 * 14 物流
 * 15 用户
 * 16 库存
 */
public enum BizCodeEnum {
    UNKNOWN_EXCEPTION(10000, "系统未知异常"),
    VALID_EXCEPTION(10001, "参数格式校验失败"),
    SMS_CODE_EXCEPTION(10002, "验证码获取频率过高,请稍后再试"),
    TO_MANY_REQUEST_EXCEPTION(10003, "请求流量过大"),
    PRODUCT_UP_EXCEPTION(11000, "商品上架异常"),
    USER_EXIST_EXCEPTION(15001, "用户已存在"),
    PHONE_EXIST_EXCEPTION(15002, "手机号已存在"),
    NO_STOCK_EXCEPTION(16001, "商品库存不足"),
    ACCOUNT_OR_PASSWORD_INVALID_EXCEPTION(15003, "帐号或密码错误");

    private int code;
    private String msg;

    BizCodeEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
